<!-- Main content -->
@extends('layouts.default')
@section('css')
    <link rel="stylesheet" href="{{asset('admin-lte/plugins/datatables/dataTables.bootstrap4.css')}}">
    {{--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">--}}
    <style>
        .help-block-error{
            color:red;
        }
    </style>
@stop

@section('content')
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h3 class="card-title">充值优惠管理 / <a class="text-primary" href="{{url('admin/recharge/index')}}">充值优惠配置</a></h3>
                </div>

                <div class="card-body">
                    @include('layouts.message')
                    <form role="form" method="post" action="{{url('admin/recharge/save')}}" id="validation-form">
                        <div class="card-body">
                            {{csrf_field()}}
                            <div class="form-group">
                                <label for="recharge_money">充值金额</label>
                                <input name="Recharge[recharge_money]" type="number" class="form-control" id="recharge_money" placeholder="充值满多少金额" value="{{isset($config_arr)?$config_arr['recharge_money']:''}}">
                            </div>
                            <div class="form-group">
                                <label for="gift_money">赠送金额</label>
                                <input name="Recharge[gift_money]" type="number" class="form-control" id="gift_money" placeholder="赠送金额" value="{{isset($config_arr)?$config_arr['gift_money']:''}}">
                            </div>
                            <div class="form-group">
                                <label for="gift_limit">优惠金额上限</label>
                                <input name="Recharge[gift_limit]" type="number" class="form-control" id="gift_limit" placeholder="不填则不限制优惠金额上限" value="{{isset($config_arr)?$config_arr['gift_limit']:''}}">
                            </div>
                            <div class="form-group">
                                <label for="recharge_limit">充值赠送次数</label>
                                <input name="Recharge[recharge_limit]" placeholder="不填则不限充值赠送次数" type="number" class="form-control" id="recharge_limit" value="{{isset($config_arr)?$config_arr['recharge_limit']:''}}">
                            </div>
                        </div>
                        <!-- /.card-body -->

                        <div class="card-footer">
                            <button type="submit" class="btn btn-primary">保存</button>
                            <button type="reset" class="btn btn-info">重置</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

@stop



@section('script')
    {{--layer插件--}}
    <script src='{{asset("admin-lte/plugins/layer-v3.1.1/layer.js")}}' type="text/javascript"></script>
    {{--jqueryVlaition插件--}}
    <script src="{{asset('admin-lte/plugins/jquery-validation/js/jquery.validate.js')}}"></script>
    <script src="{{asset('js/spu/form-validate.js')}}"></script>
    <script>
        //表单验证
        validate(
            {
                'Recharge[recharge_money]':{'required': true},
                'Recharge[gift_money]':{'required': true},
//                'Recharge[recharge_limit]':{'required': true},
//                'Recharge[gift_limit]':{'required': true}
            },
            {
                'Recharge[recharge_money]':{'required': '充值金额不能为空'},
                'Recharge[gift_money]':{'required': '赠送金额不能为空'},
//                'Recharge[recharge_limit]':{'required': '充值优惠次数不能'},
//                'Recharge[gift_limit]':{'required': '优惠类型不能为空'}
            }
        );
    </script>
@stop
